export interface FormState{
    username: string;
    password: string;
    repwd: string;
    phone?: string;
    email?: string;
}
interface IRegex{
    act: RegExp;
    pwd: RegExp;
    pho: RegExp;
    eml: RegExp;
}
export const regexRule:IRegex={
    act: /^[A-Za-z0-9]{3,16}$/,
    pwd:/^(?=.*[A-Za-z])(?=.*[0-9])[A-Za-z0-9_]{6,16}$/,
    pho: /^(13[0-9]|14[5-7]|15[0-35-9]|166|17[0-8]|18[0-9]|19[89])\d{8,11}$/,
    eml:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
}

export function cerate_name():string{
    // 定义名字列表
    const firstNames = ['Alice', 'Bob', 'Charlie', 'David', 'Eve'];
    const lastNames = ['Smith', 'Johnson', 'Williams', 'Jones', 'Brown'];
    // 随机取名函数
    function generateRandomName(): string {
        // 生成随机索引
        const randomIndexFirst = Math.floor(Math.random() * firstNames.length);
        const randomIndexLast = Math.floor(Math.random() * lastNames.length);
        // 返回随机生成的名字
        return `${firstNames[randomIndexFirst]} ${lastNames[randomIndexLast]}`;
    }
    return generateRandomName()
}